package com.mydesignpattern.beijing.composite;

import com.mydesignpattern.beijing.composite.file.MyAviFile;
import com.mydesignpattern.beijing.composite.file.MyTxtFile;
import com.mydesignpattern.beijing.composite.folder.MyFolder;

/**
 * 测试客户端
 */
public class MyClient {

    public static void main(String[] args) {

        //生成文件类，供消费者使用

        MyFolder folder = new MyFolder("考研资料");
        MyFolder folder1 = new MyFolder("爱情电影");
        MyFolder folder2 = new MyFolder("新建文件夹");
        folder.addFile(folder1);
        folder.addFile(folder2);

        folder2.addFile(new MyTxtFile("笑傲江湖"));
        folder2.addFile(new MyTxtFile("天龙八部"));
        folder1.addFile(new MyAviFile("苍老师课堂"));
        folder1.addFile(new MyAviFile("泷老师课堂"));


        MyFile file = new MyTxtFile("javascript 权威指南");
        //客户端调用（对客户端来说，不关心是folder还是file，只要能调用功能就行了，不想在乎它们的差异）
        folder.printFiles();
        file.printFiles();

    }


}
